WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
motion_provider.h
Go to the documentation of this file.
1// WOLF - Copyright (C) 2020-2026
2// Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
3// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and
4// Joan Vallvé Navarro (jvallve@iri.upc.edu)
5// All rights reserved.
6//
7// This file is part of WOLF: http://www.iri.upc.edu/wolf
8// WOLF is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License version 3
10// as published by the Free Software Foundation.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19#pragma once
20
21#include "core/common/wolf.h"
24#include "yaml-cpp/yaml.h"
25
26namespace wolf
27{
28class TimeStamp;
29
31
33{
34 public:
39 MotionProvider(const TypeComposite& _state_types, const YAML::Node& _params);
40
42 virtual ~MotionProvider();
43
44 // Queries to the processor
48 virtual TimeStamp getTimeStamp() const = 0;
49
54 virtual VectorComposite getState(StateKeys _keys = "") const = 0;
55
61 virtual VectorComposite getState(const TimeStamp& _ts, StateKeys _keys = "") const = 0;
62
67
71 void setOdometry(const VectorComposite&);
72
76 bool isStateProvider() const;
77
81 unsigned int getOrder() const;
82
86 void setOrder(unsigned int);
87
88 protected:
92 void addTypes(const TypeComposite& _state_types);
93
95 unsigned int state_provider_order_;
96
97 private:
98 TypeComposite state_types_;
99 VectorComposite odometry_;
100 mutable std::mutex mut_odometry_;
101};
102
103} // namespace wolf
104
106namespace wolf
107{
109
111{
112 return is_state_provider_;
113}
114
115inline unsigned int MotionProvider::getOrder() const
116{
117 if (not isStateProvider())
118 throw std::runtime_error("MotionProvider::getOrder: not a motion provider, doesn't have order");
120}
121
122inline void MotionProvider::setOrder(unsigned int _order)
123{
124 if (not isStateProvider())
125 throw std::runtime_error("MotionProvider::getOrder: not a motion provider, cannot have order");
126 state_provider_order_ = _order;
127}
128
129} /* namespace wolf */
Definition: motion_provider.h:33
virtual ~MotionProvider()
Destructor for the MotionProvider class.
Definition: motion_provider.h:108
virtual VectorComposite getState(const TimeStamp &_ts, StateKeys _keys="") const =0
Get the state at a specific time.
void setOdometry(const VectorComposite &)
Set the odometry.
Definition: motion_provider.cpp:57
virtual TimeStamp getTimeStamp() const =0
Get the timestamp of the last motion.
void addTypes(const TypeComposite &_state_types)
Add types to the motion provider.
Definition: motion_provider.cpp:32
VectorComposite getOdometry() const
Get the odometry.
Definition: motion_provider.cpp:85
unsigned int state_provider_order_
If a state provider, the order to be used by the problem.
Definition: motion_provider.h:95
virtual VectorComposite getState(StateKeys _keys="") const =0
Get the state at the last time.
unsigned int getOrder() const
Get the order of the state provider.
Definition: motion_provider.h:115
MotionProvider(const TypeComposite &_state_types, const YAML::Node &_params)
Constructor for the MotionProvider class.
Definition: motion_provider.cpp:25
bool isStateProvider() const
Check if the motion provider is configured as a state provider.
Definition: motion_provider.h:110
bool is_state_provider_
Whether this motion provider is configured as a state provider.
Definition: motion_provider.h:94
void setOrder(unsigned int)
Set the order of the state provider.
Definition: motion_provider.h:122
TimeStamp implements basic functionalities for time stamps.
Definition: time_stamp.h:39
Definition: vector_composite.h:27
Definition: capture_base.h:23
std::string StateKeys
Definition: composite.h:31
WOLF_PTR_TYPEDEFS(CaptureLandmarksExternal)